<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		<script type="text/javascript">
			// for(声明; 判定 ; 自增){
			for(var i = 0 ; i< 10 ; i++){
				document.write("值：" + i + "<br>");
			}
			
			var j = 0;
			
			while(j < 10){
				document.write("j="+j);
				j++;
			}
			
			//1如何循环数组 [10,32,13,24,35,55,6]
			var arr = [10,32,13,24,35,55,6];
			//数组的长度
			var len = arr.length;
			//因为数组是下标由0开始,所以在循环的时候会习惯写0
			for(var l = 0;l<len ; l++){
				//输出到html页面中\n失效了
				document.write("<br /> "+arr[l]+"\r ");
				// alert(arr[l]+'\n'+"哈哈");
			}
			//2(不常用)如何循环对象 {a:1;b:2;c:3}
			var obj = {"name":"刘强东","sex":"男","age":35};
			var k = Object.keys(obj);//["name", "sex", "age"]
			for (var i = 0; i < k.length; i++) {
				// console.log(k[i]);
				console.log( k[i]  +" = " +  obj[k[i]]);
			}	
			//第二种 高阶方法
			for(var key in obj){
				console.log(key + " = " + obj[key]);
			}
			
			
			
			var a = "1bdsfj9012830498";//字符串 又名  字符数组 字符连在一起
			// console.log(a[2]);
			for(var c=0;c<a.length;c++){
				console.log(a[c]);
			}
		</script>
	</body>
	
</html>
